package com.stormrage.edu.dao.edu.impl;

import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import com.stormrage.edu.dao.edu.EduLecDao;
import com.stormrage.entity.edu.EduLec;
import com.stormragetech.core.dao.MysBaseDao;
import com.stormragetech.core.exception.StormrageTechException;

/**
 * @Title: EduLecDaoImpl.java
 * @Package com.stormrage.edu.dao.edu.impl
 * @Description: 讲师 Dao
 * @author www.stormragetech.com
 * @date 2016年4月16日
 * @version V1.0
 */
@Repository
public class EduLecDaoImpl extends MysBaseDao implements EduLecDao {

	private static final Logger logger = LoggerFactory.getLogger(EduLecDaoImpl.class);

	@Override
	public EduLec queryById(Map<String, Object> map) throws StormrageTechException {

		logger.debug(" 【 Dao 】-【 EduLecDao 】-【 QueryById 】-【 STARTED 】");

		final String query = "SELECT * FROM edu_lec WHERE id = :id";
		logger.debug(" 数据库执行语句为 " + query);

		EduLec entity = queryObject(query, EduLec.class, map);

		logger.debug(" 【 Dao 】-【 EduLecDao 】-【 QueryById 】-【 COMPLETED 】");
		return entity;
		
	}

	@Override
	public List<EduLec> queryList() throws StormrageTechException {

		logger.debug(" 【 Dao 】-【 EduLecDao 】-【 QueryList 】-【 STARTED 】");

		final String query = "SELECT * FROM edu_lec";
		logger.debug(" 数据库执行语句为 " + query);

		List<EduLec> array = queryList(query, EduLec.class);

		logger.debug(" 【 Dao 】-【 EduLecDao 】-【 QueryList 】-【 COMPLETED 】");
		return array;
	}

	@Override
	public List<EduLec> queryListForIndex() throws StormrageTechException {

		logger.debug(" 【 Dao 】-【 EduLecDao 】-【 QueryListForIndex 】-【 STARTED 】");

		final String query = "SELECT * FROM edu_lec WHERE idx = 1 LIMIT 0, 2";
		logger.debug(" 数据库执行语句为 " + query);

		List<EduLec> array = queryList(query, EduLec.class);

		logger.debug(" 【 Dao 】-【 EduLecDao 】-【 QueryListForIndex 】-【 COMPLETED 】");
		return array;
	}

}
